package com.frejoys.app.controller;

import com.frejoys.common.aop.Authority;
import com.frejoys.common.aop.Authorization;
import com.frejoys.common.constant.CommonConstant;
import com.frejoys.common.dto.app.StoreCodeDto;
import com.frejoys.common.response.Result;
import com.frejoys.common.vo.app.StoreIdAndTypeVo;
import com.frejoys.service.StoreCodeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "店铺支付码", description = "店铺支付码")
@RestController
@RequiredArgsConstructor
@RequestMapping(CommonConstant.routePrefixApp)
@Authorization(Authority.Private)
public class StoreCodeController {

    private final StoreCodeService storeCodeService;

    @PostMapping("/storeCode/storeIdAndCategory")
    @Operation(summary = "根据支付码获取店铺id和类型")
    public Result<StoreIdAndTypeVo> storeIdAndType(@RequestBody @Validated StoreCodeDto dto){
        return Result.success(storeCodeService.storeIdAndType(dto));
    }

}
